<style type="text/css">
	.dot{
		border:1px solid #fff;width:12px;height:12px;border-radius: 12px;float:left;margin:0 5px;
	}
</style>
<div class="full_w">
    <div class="h_title"><?php echo Yii::t('AdmincpModule.admincp', 'Update Email Subscription'); ?></div>
    <?php 
        foreach(Yii::app()->admin->getFlashes() as $key => $message){
            echo '<div class="n_'.$key.'"><p>'.$message."</p></div>\n";
        }
    ?>
    <form action="" method="post" id="frmMail">
        <div class="element">
            <label for="title">Subject <span class="red">*</span></label>
            <input type="text" name="mail[mail_subject]" id="subject" class="text required" value="<?php echo isset($arrItemInfo['mail_subject'])?$arrItemInfo['mail_subject']:null; ?>">
        </div>
        <div class="element">
            <label for="intro">Description:</label>
            <textarea name="mail[mail_description]" class="textarea" id="description"><?php echo isset($arrItemInfo['mail_description'])?$arrItemInfo['mail_description']:null; ?></textarea>
        </div>
        <div class="element">
            <label for="body">Body:</label>
            <textarea name="mail[mail_body]" class="textarea" id="body"><?php echo isset($arrItemInfo['mail_body'])?$arrItemInfo['mail_body']:null; ?></textarea>
        </div>
          
    	<?php if(!empty($arrLists)):
				if(isset($arrItemInfo['lists'])){
					$arrListsOfEmail = array();
					foreach($arrItemInfo['lists'] as $R){
						$arrListsOfEmail[] = $R['list_id'];
					} 
				}
		?>
    	<fieldset>
            <legend>Lists</legend>
            <?php foreach($arrLists as $R): ?>
            <div class="element">
                <label for="name" style="float:left; width:150px;"><div style="background-color:<?php echo $R['list_color']; ?>;" class="dot"></div> <?php echo $R['list_name']; ?>:</label>
                <div>
                    <label style="float:left;"><input type="radio" name="list[<?php echo $R['list_id']; ?>]" id="list_<?php echo $R['list_id']; ?>" value="1" <?php if(in_array($R['list_id'], $arrListsOfEmail)): ?>checked<?php endif; ?>> Yes </label>
                    <label style="float:left;"><input type="radio" name="list[<?php echo $R['list_id']; ?>]" id="list_<?php echo $R['list_id']; ?>" value="0" <?php if(!in_array($R['list_id'], $arrListsOfEmail)): ?>checked<?php endif; ?>> No </label>
            	</div>
            </div>
            <?php endforeach; ?>
    	</fieldset>
        <?php endif; ?>
        
        <div class="entry">
           <input type="hidden" name="id" id="id" value="<?php echo isset($arrItemInfo['mail_id'])?$arrItemInfo['mail_id']:null; ?>">
           <button type="submit">Submit</button> <button>Cancel</button>
        </div>
    </form>
</div>
<script type="text/javascript">
	$(function(){
		$('#frmMail').validate();
	});
</script>